//
//  MulImageModelCell.m
//  BobNews
//
//  Created by lanou3g on 16/5/6.
//  Copyright © 2016年 YJC. All rights reserved.
//

#import "MulImageModelCell.h"
#import "UIImageView+WebCache.h"
#import "BigImageView.h"
@interface MulImageModelCell ()
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *classificationLabel;
@property (weak, nonatomic) IBOutlet UILabel *concernCountLabel;

@property (weak, nonatomic) IBOutlet UIImageView *firstImageView;
@property (weak, nonatomic) IBOutlet UIImageView *secondImageView;
@property (weak, nonatomic) IBOutlet UIImageView *thirdImageView;
@property (weak, nonatomic) IBOutlet UILabel *talkCountLabel;

@end
@implementation MulImageModelCell

- (void)setModel:(MulImageViewModel *)model {
    if (_model != model) {
        _model = model;
    }
}

- (void)layoutSubviews {
    self.nameLabel.text = self.model.name;
    self.classificationLabel.text = self.model.classification;
    self.concernCountLabel.text = [NSString stringWithFormat:@"%@关注",self.model.concernCount];
    self.talkCountLabel.text = [NSString stringWithFormat:@"%@评论",self.model.talkCount];
    [self.firstImageView sd_setImageWithURL:[NSURL URLWithString:self.model.talkPicture[0]]];
    [self.secondImageView sd_setImageWithURL:[NSURL URLWithString:self.model.talkPicture[1]]];
    [self.thirdImageView sd_setImageWithURL:[NSURL URLWithString:self.model.talkPicture[2]]];
    self.firstImageView.userInteractionEnabled = YES;
    self.secondImageView.userInteractionEnabled = YES;
    self.thirdImageView.userInteractionEnabled = YES;
    if (self.firstImageView) {
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewAction:)];
        [self.firstImageView addGestureRecognizer:tap];
    }
    if (self.secondImageView) {
        UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewSecondAction:)];
        [self.secondImageView addGestureRecognizer:tap1];
    }
        if(self.thirdImageView) {
        UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(bigImageViewThirdAction:)];
        [self.thirdImageView addGestureRecognizer:tap2];

    }
    
    
}
- (void)bigImageViewAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.firstImageView];
}
- (void)bigImageViewSecondAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.secondImageView];
}
- (void)bigImageViewThirdAction:(UITapGestureRecognizer *)tap {
    [BigImageView showImage:self.thirdImageView];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
